package demo.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigEncodingController {
	
	// application.properties
	@Value("${pet1}")
	private String pet1;
	
	// config.properties
	@Value("${pet2}")
	private String pet2;
	
	@Autowired
	Environment environment; 
	
	@RequestMapping("/configEncodingInfo")
	public Object info()throws Exception{
		Map map = new HashMap();
		
		map.put("pet1", pet1);
		map.put("pet1_2", environment.getProperty("pet1"));

		map.put("pet2", pet2);

		return map;
	}
	
	
	
		
}